<?php
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';

class unit_KeyValueWorkflowContainerTest extends sfPHPUnitBaseTestCase
{

  public function testScenarioGetValueShouldReturnValueSetInSetValue ()
  {
    $container = new KeyValueWorkflowContainer();
    $key = 'key';
    $value = 'value';
    
    $container->setValue($key, $value);
    $act = $container->getValue($key);
    
    $this->assertEquals($value, $act);
  }

  public function testGetValueShouldReturnDefaultValueIfValueIsNotSet ()
  {
    $container = new KeyValueWorkflowContainer();
    $key = 'key';
    $default = 'default';
    
    $act = $container->getValue($key, $default);
    
    $this->assertEquals($default, $act);
  }

  public function testHasValueShouldReturnTrueIfValueIsSet ()
  {
    $container = new KeyValueWorkflowContainer();
    $key = 'key';
    $value = 'value';
    
    $container->setValue($key, $value);
    $act = $container->hasValue($key);
    
    $this->assertTrue($act);
  }

  public function testHasValueShouldReturnFalseIfValueIsNotSet ()
  {
    $container = new KeyValueWorkflowContainer();
    $key = 'key';
    
    $act = $container->hasValue($key);
    
    $this->assertFalse($act);
  }

//  public function testScenarioGetValueShouldReturnValueFromMapping ()
//  {
//    $container = new KeyValueWorkflowContainer();
//    $key = 'key';
//    $mapped_key = 'mapped_key';
//    $value = 'value';
//    
//    $container->setValue($key, $value);
//    $container->map($key, $mapped_key);
//    $act = $container->getValue($mapped_key);
//    
//    $this->assertEquals($value, $act);
//  }

}